﻿using LoveNote.Database.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LoveNote.Database.Sqlite
{
    public class SqliteDbContext : DbContext
    {
        private string database = "lovenote.db";
        public DbSet<UserEntity> Users { get; set; }
        public DbSet<NoteEntity> Notes { get; set; }
        public DbSet<WorkEntity> Works { get; set; }
        public DbSet<PictureEntity> Pictures { get; set; }
        public DbSet<CustomerEntity> Customers { get; set; }
        public DbSet<ProcessEntity> Processes { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);

            var local = Environment.SpecialFolder.LocalApplicationData;
            var path = Environment.GetFolderPath(local);
            var fullname = Path.Join(path, database);
            optionsBuilder.UseSqlite($"data source = {database}");
        }
    }
}
